package freecomm.study.notes;

import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask;
import android.util.Log;

public class NoteWidgetProvider extends AppWidgetProvider
{

    class saveDB extends AsyncTask<Integer, Void, Void>{

        @Override
        protected Void doInBackground(Integer... params)
        {
            // TODO Auto-generated method stub
            SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase("/data/data/freecomm.study.notes/databases/note", null);
            db.delete("note", "_widgetid=?", new String[]{params[0]+""});
            db.close();
            return null;
        }
        
    }
    @Override
    public void onDeleted(Context context, int[] appWidgetIds)
    {
        // TODO Auto-generated method stub
        new saveDB().execute(appWidgetIds[0]);
        super.onDeleted(context, appWidgetIds);
        
    }

    @Override
    public void onDisabled(Context context)
    {
        // TODO Auto-generated method stub
        super.onDisabled(context);
    }

    @Override
    public void onEnabled(Context context)
    {
        // TODO Auto-generated method stub
        super.onEnabled(context);
    }

    @Override
    public void onReceive(Context context, Intent intent)
    {
        // TODO Auto-generated method stub
        super.onReceive(context, intent);
    }

    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager,
            int[] appWidgetIds)
    {
        // TODO Auto-generated method stub
        super.onUpdate(context, appWidgetManager, appWidgetIds);
    }

}
